package com.lan.controller.formdata;

import com.lan.entity.sys.User;
import com.lan.service.sys.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 *  比例
 * </p>
 *
 *
 * @author shadow
 * @since 2022-10-04
 */
@Controller
@RequestMapping("formData")
public class ProportionController {

    @Resource
    private UserService userService;

    /**
     * 男女比例.
     *
     * */
    @GetMapping("sex")
    public String sex(final ModelMap model) {
        Map<String, Integer> map = new HashMap<>();
        User user = new User();
        user.setSex("男");
        map.put("男", userService.getCountByWrapper(user));
        user.setSex("女");
        map.put("女", userService.getCountByWrapper(user));
        model.addAttribute("map", map);
        return "formData/sex";
    }
}
